package com.blacktry.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blacktry.entity.model.Admin;
import com.blacktry.entity.model.ApiResult;
import com.blacktry.entity.model.ExamManage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blacktry.entity.model.request.ExamRequest;
import com.blacktry.entity.model.request.ScoreRequest;
import com.blacktry.entity.model.request.StudentRequest;
import io.swagger.models.auth.In;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 考试管理表 服务类
 * </p>
 *
 * @author blackTry
 * @since 2021-06-24
 */
public interface ExamManageService extends IService<ExamManage> {
     //添加考试
    Integer insert(ExamManage examManage);
     //查看考试状态
    List<ExamManage> selectEnable(Integer flag);
    //更新考试状态
    Integer updateEnable(Integer id,Integer flag);
       //查看所有考试
    List<ExamManage> selectExam();
       //查询单个考试
    ExamManage selectExamOne(Integer id);
    //分页查看所有考试
    Page<ExamManage> selectExamPage(ExamManage examManage,Page<ExamManage> examManagePage);

    Integer deleteExam ( Integer id);

    Integer updateExam (ExamManage examManage);

       //更新或添加考试
    Integer updateOrInsertExam(ExamManage examManage);

    //学生根据年级查看本年级所有考试
    Page<ExamManage> selectExamPage2(String userName,ExamRequest examRequest,Page<ExamManage> examManagePage);


    //教师查看具体考试
    Page<ExamManage> teachSelectExamPage(ExamRequest examRequest, Page<ExamManage> examManagePage);

    //查询每位考生的姓名，班级，考分，用时
    List<ScoreRequest> selectByExamId(String examId);

    //根据考试id查询能参与的班级
    String seclctExamClass(String id);

    //根据考试id查询能参与的学生
    List<Admin> seclctExamStudent(String id);

    //根据班级查询包含的学生
    List<Admin> seclctStudentByclassName(String className);

    //查询考试及格不及格缺考尚未改卷的人数
    Map<String,Integer> selectNumByExamId(String examId);

    Map<String,List<StudentRequest>> selectStudentByExamId(String examId);



    //学生提交试卷and更改考试状态
    public  void updateExamState(Integer id,String examId,String userName,Boolean enable);

    Page<ExamManage> selectStudentOnlineExam(ExamManage examManage, Page<ExamManage> examManagePage);

    //根据时间更新考试过期状态
    public  void updateExamStateByTime();

}
